package com.sky.mapper.user;

import com.github.pagehelper.Page;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.pojo.Orders;
import com.sky.vo.OrderStatisticsVO;
import com.sky.vo.OrderVO;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

public interface OrdersMapper {
    void save(Orders orders);

    Orders selectByNumber(String orderNumber);

    List<Orders> selectByStatus(Integer pendingPayment, LocalDateTime time);

    void update(Orders orders);

    Page<OrderVO> selectPage(OrdersPageQueryDTO queryDTO);

    OrderStatisticsVO countStatus();

    Page<OrderVO> selectOrders(OrdersPageQueryDTO dto);

    OrderVO selectById(Long orderId);

    OrderVO selectQuanById(Long orderId);

    void updateRejection(Orders orders);

    Orders selectByTraNo(Long tradeNo);
    @Select("select sum(amount) from orders where order_time> concat(#{date}, ' 00:00:00') and order_time < concat(#{date}, ' 23:59:59') and status=6")
    Double selectAmountByDate(String date);

    Map<String, Object> selectAmountByDate2(List<String> dateList);

    int selectCountOrStatus(LocalDate beginTime, LocalDate end, Integer status);

    Map<String, Object> selectOrderCountByDate(List<String> dateList,Integer status);


    List<Map> selectDishByDate(LocalDate beginTime, LocalDate end);

    Map<String, Object> selectOrdersNumByToday(LocalDate begin,LocalDate end);

    Integer selectValidOrders(LocalDate begin,LocalDate end);

    Double selectEffectiveOrder(Integer validOrderCount, LocalDate begin,LocalDate end);

    Map<String, Object> selectCountByStatus(LocalDate date);
}
